package com.zhxh.nzpos.query;

import java.util.ArrayList;
import java.util.HashMap;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.SimpleAdapter;

import com.zhxh.nzpos.BaseActivity;
import com.zhxh.nzpos.R;

/**
 * 统计查询主界面
 * @author wangzt
 *
 */
public class QueryManageActivity extends BaseActivity {
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_query_manage);
        initViews();
    }
	
	private void initViews() {
		GridView gridView = (GridView) findViewById(R.id.grid_query);

		ArrayList<HashMap<String, Object>> imagelist = new ArrayList<HashMap<String, Object>>();
		HashMap<String, Object> map1 = new HashMap<String, Object>();
		/*map1.put("image", R.drawable.query_order);
		//map1.put("text", getResources().getString(R.string.buyin_query));
		imagelist.add(map1);
		HashMap<String, Object> map2 = new HashMap<String, Object>();
		map2.put("image", R.drawable.query_buyin);
		//map2.put("text", getResources().getString(R.string.input_query));
		imagelist.add(map2);*/
		HashMap<String, Object> map3 = new HashMap<String, Object>();
		map3.put("image", R.drawable.query_sellout);
		//map3.put("text", getResources().getString(R.string.sell_query));
		imagelist.add(map3);
		/*
		HashMap<String, Object> map4 = new HashMap<String, Object>();
		map4.put("image", R.drawable.query_stock);
		//map4.put("text", getResources().getString(R.string.stock_query));
		imagelist.add(map4);*/
		
		HashMap<String, Object> map5 = new HashMap<String, Object>();
		map5.put("image", R.drawable.query_goods);
		//map5.put("text", getResources().getString(R.string.goods_query));
		imagelist.add(map5);
		
	/*	HashMap<String, Object> map6 = new HashMap<String, Object>();
		map6.put("image", R.drawable.query_card_active);
		//map6.put("text", getResources().getString(R.string.card_active_query));
		imagelist.add(map6);
		HashMap<String, Object> map7 = new HashMap<String, Object>();
		map7.put("image", R.drawable.query_supplier);
		//map7.put("text", getResources().getString(R.string.supplier_query));
		imagelist.add(map7);*/
		
		SimpleAdapter simpleAdapter = new SimpleAdapter(this, imagelist,
				R.layout.compose_grid_item, new String[] { "image", "text" },
				new int[] { R.id.compose_grid_image, R.id.compose_grid_text });
		gridView.setAdapter(simpleAdapter);
		
		gridView.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
					long arg3) {
				Intent intent = new Intent();
				switch (pos) {
				//case 0:
				/*	intent.setClass(getApplicationContext(), OrderQueryActivity.class);
					startActivity(intent);
					break;
				case 1:
					intent.setClass(getApplicationContext(), BuyInQueryActivity.class);
					startActivity(intent);
					break;*/
				case 0:
					intent.setClass(getApplicationContext(), SellOutQueryActivity.class);
					startActivity(intent);
					break;
				/*case 3:
					intent.setClass(getApplicationContext(), StockQueryActivity.class);
					startActivity(intent);
					break;*/
				case 1:
					intent.setClass(getApplicationContext(), GoodsQueryActivity.class);
					startActivity(intent);
					break;
/*				case 5:
					intent.setClass(getApplicationContext(), CardActiveQueryActivity.class);
					startActivity(intent);
					break;
				case 6:
					intent.setClass(getApplicationContext(), SupplierQueryActivity.class);
					startActivity(intent);
					break;*/

				}
				
			}
		});
	}
}
